@echo off
:: 项目目录
set appDir=D:\mnt\app\appServer\hzzbs\
:: 项目jar包名称
set appJar=hzzbs-1.0.jar
:: 查询项目pid,并根据pid关闭
for /f "tokens=1" %%a in ('jps -l ^| findstr %appJar%') do taskkill /f /pid %%a
:: 判断项目是否存在,否,则创建
if not exist "%appDir%" ( md "%appDir%" )
:: 判断config目录是否存在,否(创建)
if not exist "%appDir%config" (md "%appDir%config")
:: 判断logs目录是否存在,否(创建)
if not exist "%appDir%logs" (md "%appDir%logs")
:: 清空日志
:: del /q /s "%appDir%logs\*.*"
:: cp编译后的jar包与配置文件到项目目录
copy /y "%WORKSPACE%\doc\app\application-pro.yml" "%appDir%%config\application.yml"
copy /y "%WORKSPACE%\doc\app\logback-spring-pro.xml" "%appDir%%config\logback-spring.xml"
copy /y "%WORKSPACE%\target\%appJar%" "%appDir%%appJar%"
:: 项目后台启动
cd %appDir%%
start javaw -jar %appDir%%appJar%
exit